def for_loop2(x):
result = 0
for i in x:
if i == 'a':
result += 1
return result
Function Call | Return Value | |||
---|---|---|---|---|
for_loop2('athenian') | → | |||
for_loop2('apples') | → | |||
for_loop2('hello') | → | |||
for_loop2('') | → | |||
for_loop2(' ') | → | |||
for_loop2('alphabet') | → |
Experiment with this code on Gitpod.io